<?

	function stampaAlbero($albero, $liv = 0, $treename='', $treeclass='')
	{
		if(count($albero[figli])>0)
		{
			if($treename!='')$tmp="id=\"$treename\" class=\"$treeclass\"";
			else $tmp='';
			if($albero[id]==$_REQUEST[id_categoria]) $rel='sel="true"';
			else $rel='';
			
			echo "\n<ul $rel $tmp >";
			$liv ++;
			foreach($albero[figli] as $idc=>$arrc)
			{
				echo "\n<li><a href=\"/admin/categoria.php?id_categoria=$arrc[id]\"><img  src=\"/_admin/img/folder_blue_open.png\" border=\"0\" /> ".$arrc[nome]."</a>";
                            

				stampaAlbero($arrc, $liv);
				echo "</li> ";
			}
			$liv--;
			echo "\n</ul>";
			
		}
	}



//print_r($cat_struct);
?>
<!-- start sidebar -->
  <div id="sidebar"> 
  

  
  
  
    <ul>
     
      <li> 
      
      
       
      
      
      
        <h2>Catalogo Prodotti</h2>
        <div class="treeexpand"> <a href="javascript:ddtreemenu.flatten('treemenu1', 'expand')">Expand 
        All</a> | <a
		href="javascript:ddtreemenu.flatten('treemenu1', 'contact')">Contact All</a> </div>
       
		<?
		$albero = $cat_struct[albero][0];
		$liv = 0;
		stampaAlbero($albero, $liv, 'treemenu1','treeview');
		
		?> 
		
		

      </li>
      
       <li> 
        <h2>Menu funzioni</h2>
       
        
        <ul id="treemenu2" class="treeview">

		  <li><a  href="/admin/categoria.php?mod=new"><img align="absmiddle" src="/_admin/img/edit_add.png" border="0" /> Inserisci nuova cartella</a> </li>
		  <li><a  href="/admin/prodotto.php?mod=new"><img align="absmiddle" src="/_admin/img/edit_add.png" border="0" /> Inserisci nuovo prodotto</a> </li>

        </ul>
      </li>
      
      
    </ul>
  </div>
<script type="text/javascript">
//ddtreemenu.createTree(treeid, enablepersist, opt_persist_in_days (default is 1))
ddtreemenu.createTree("treemenu1", true)
ddtreemenu.createTree("treemenu2", true)
</script>

  <!-- end sidebar -->